package com.ferryc.configer;

import com.baomidou.mybatisplus.core.injector.ISqlInjector;
import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

/**
 * Created by Ferry Chen on 2019/11/1.
 */
@Configuration
public class MybatisPlusConfig {

    //SQL执行效率插件
    @Bean
    @Profile({"test"})// 设置 dev test 环境开启
    public PerformanceInterceptor performanceInterceptor(){
        return new PerformanceInterceptor();
    }

    //逻辑删除用，3.1.1之后的版本可不需要配置该bean，但项目这里用的是3.1.0的
    @Bean
    public ISqlInjector sqlInjector(){
        return  new LogicSqlInjector();
    }
}
